add translate text messages using system api#3215
Conversation
|
cool function! however, there is a high chance that this api is not working offline but also online and affects confidentiality therefore. i did not find any proof that this is not the case, but even if it offline that today, it maybe differently tomorrow, with any iOS update. otoh, ppl may use worse tools for translation ... still, as delta chat is not social media, but meant for friends&family, there is a high chance that two ppl speak the same language, so the pr has comparable low effect anyways. |
|
Thanks for the feedback. I agree that confidentiality is the main concern here. According to Apple’s documentation, translation is performed on-device after the required language models have been downloaded. I can also verify the behavior in airplane mode and add a clear note that the feature is only available when on-device translation is supported. Of course, we cannot guarantee that Apple will never change the implementation in a future iOS release. However, the same applies to many system APIs. We can only rely on the documented behavior of the current API and avoid using the feature whenever the system cannot provide an on-device translation. Regarding the usefulness, I agree that it may not be a core feature for every user. Still, it can be helpful in international groups, communities, and conversations between multilingual friends or family members. It also avoids users copying potentially sensitive messages into third-party translation services. |
|
Apple documents that TranslationSession uses on-device ML models. I can additionally restrict the feature to language pairs whose LanguageAvailability status is .installed, so message text is passed to the translation session only after the required local models are already present. This gives us a clear practical offline guarantee for the current documented implementation, and it can be verified in airplane mode and with network monitoring. A fully enforceable guarantee would require shipping and running our own translation model, which would have substantial app-size and maintenance costs. |
|
|
||
| @available(iOS 17.4, *) | ||
| private func presentTranslation(text: String) { | ||
| let host = UIHostingController(rootView: TranslationPresentationView(text: text) { [weak self] in |
There was a problem hiding this comment.
Explicitly add the onDismiss label here so it is more readable what this closure does.
| } | ||
|
|
||
| @available(iOS 17.4, *) | ||
| private func presentTranslation(text: String) { |
There was a problem hiding this comment.
Move this and the TranslationPresentationView to their own file eg Translation.swift
Add a text message translation using the Apple Translate API
Details
cropped-870x1680-Screen.Recording.2026-07-22.at.2.40.13.PM.mp4